package yeliuhuishi.GroupingComparator;


import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class ItemidGroupingComparator extends WritableComparator {
    protected ItemidGroupingComparator() {
        super(OrderBean.class, true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {

        OrderBean abean = (OrderBean) a;
        OrderBean bbean = (OrderBean) b;

        // 将item_id 相同的bean都视为相同，从而聚合为一组
        return abean.getItem().compareTo(bbean.getItem());
    }
}
